package vip.zhenzicheng.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import vip.zhenzicheng.entity.Product;

/**
 * @author zhenzicheng
 * @DESCRIPTION:
 * @DATE: 2022/04/24 6:00 PM
 */
@Mapper
public interface ProductMapper {

  @Select("select * from  product where id = #{id}")
  Product getProduct(@Param("id") Integer id);

  @Update("update product set stock = stock - 1 where id = #{id}")
  int deductStock(@Param("id") Integer id);
}
